package com.estar.integaration.Reader;

import com.alibaba.excel.EasyExcel;
import com.estar.integaration.Reader.Listener.ReceiptComeLedgerListener;
import com.estar.integaration.Reader.Listener.SupplierAccountPeriodListener;
import com.estar.integaration.entity.paymentPlanEntity.ReceiptComeLedger;
import com.estar.integaration.entity.paymentPlanEntity.SupplierAccountPeriod;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: YJL
 * Date: 2022/2/17 15:46
 * 供应商账期.xlsx
 **/
public class SupplierAccountPeriodReader {

  List<String> addresses = new ArrayList<>();
  List<SupplierAccountPeriod> list = new ArrayList<>();

  public SupplierAccountPeriodReader(List<String> addresses) {
    this.addresses = addresses;
  }

  public  List<SupplierAccountPeriod> readDueSupplierAPR(){
    for(String address : addresses){
      List<SupplierAccountPeriod> tmpList = new ArrayList<>();
      EasyExcel.read(address,SupplierAccountPeriod.class,new SupplierAccountPeriodListener(tmpList))
          .sheet(0)
          .headRowNumber(1)
          .doRead();
      list.addAll(tmpList);
    }
    return list;
  }
}
